#include "comm.hpp"

int main()
{
    key_t key = GetKey();
    int shmid = GetShm(key);
    char* s = (char*)shmat(shmid, nullptr, 0);

    //等待
    int fd = open(filename, O_WRONLY);
    std::cout << "open success" << std::endl;
    char c = 'a';
    for(; c <= 'z'; c++)
    {
        s[c - 'a'] = c;
        s[c - 'a' + 1] = 0;
        std::cout << s << std::endl;
        std::cout << "write : " << c << " done" << std::endl;
        sleep(1);

        write(fd, &c, sizeof c);
    }

    shmdt(s);
    close(fd);
    return 0;
} 